package com.isaiah.set;

import com.isaiah.tree.AVLTree;

/**
 * @Title: 基于AVL树的集合实现
 * @Description: ${todo}
 * @author: Haijun
 * @emial: isaiah@sohu.com
 * @date 2020/5/2711:11
 */
public class AVLTreeSet<E extends Comparable<E>> implements Set<E> {
    private AVLTree<E,Object> avl;

    public AVLTreeSet() {
        avl = new AVLTree<>();
    }

    @Override
    public void add(E e) {
        avl.add(e, null);
    }

    @Override
    public void remove(E e) {
        avl.remove(e);
    }

    @Override
    public boolean contains(E e) {
        return avl.contains(e);
    }

    @Override
    public int size() {
        return avl.getSize();
    }

    @Override
    public boolean isEmpty() {
        return avl.isEmpty();
    }
}
